using UnityEngine;

public class RotateAroundAxis : MonoBehaviour
{
	public Vector3 axis;

	public float rotSpeed;

	public bool useAngleRange = true;

	public FloatRange angleRange;

	public bool useRealTime;

	private Quaternion startRot;

	private float angle;

	private void Start()
	{
		startRot = base.transform.rotation;
	}

	private void Update()
	{
		float num = ((!useRealTime) ? Time.deltaTime : RealTime.deltaTime);
		angle += num * rotSpeed;
		if (useAngleRange)
		{
			base.transform.rotation = Quaternion.AngleAxis(angleRange.Lerp((Mathf.Sin(angle) + 1f) * 0.5f), axis) * startRot;
		}
		else
		{
			base.transform.rotation = Quaternion.AngleAxis(angle, axis) * startRot;
		}
	}
}
